
//
//  Tool.h
//  ocCrazy
//
//  Created by mac on 2018/4/17.
//  Copyright © 2018年 dukai. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "API.h"
#import "YYKit.h"
#import "CC_LOG.h"
#import "BaseClass.h"
#import "BaseProtocol.h"
#import "AdapterForXIB.h"
#import "CategoryHeader.h"

@class PHAssetCollection;

#define CC_FRAME_X(f) [Tool cc_FrameForX:(f)]

#define CC_FRAME_NAV_X(f) [Tool cc_FrameForNavX:(f)]

#define CC_TRUE(f) ((f) * [UIScreen mainScreen].bounds.size.width / 414)

#define CC_YES @"yes"



#define CC_CURRENTVC @"cc_currentVC"

#define UID  [[NSUserDefaults standardUserDefaults] objectForKey:CC_UID]



//City = "哈尔滨市";
//Country = "中国";
//CountryCode = CN;
//FormattedAddressLines =     (
//                             "中国黑龙江省哈尔滨市道里区东八道街11号"
//                             );
//Name = "东八道街11号";
//State = "黑龙江省";
//Street = "东八道街11号";
//SubLocality = "道里区";
//SubThoroughfare = "11号";
//Thoroughfare = "东八道街";

#define CC_NAVCOLOR(f) \
-(void)viewWillDisappear:(BOOL)animated{\
  [super viewWillDisappear:animated];\
  [self setNavColor];\
  [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;\
}\
\
-(void)viewWillAppear:(BOOL)animated{\
    [super viewWillAppear:animated];\
    [self setCustomNavWithTitleColor:[UIColor blackColor] withBackColor:f];\
    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;\
}



#define CC_IsPhone(f) \
if (![Tool isPhone:f]) {\
[JKToast showWithText:@"请输入正确的手机号"];\
return ;\
}

//数字
#define NUM @"0123456789"
//字母
#define ALPHA @"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
//数字和字母
#define ALPHANUM @"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"

#define CC_COlOR(r,g,b)  [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1]

#define CC_HEXCOLOR(f) [UIColor colorWithHexString:f]

NSString *IntToString(NSInteger num);

UIFont *FloatToFont(float font);
float TrueFont(float font);
UIFont *TrueFloatToFont(float font);

@interface Tool : NSObject

+ (BOOL)CC_isX;

+ (CGFloat)cc_FrameForNavX:(CGFloat)f;

+ (CGFloat)cc_FrameForX:(CGFloat)f;

+ (void)saveImageToAlbum:(UIImage *)image withBlock:(void(^)(BOOL success, NSError * error))block;

+ (PHAssetCollection *)createdAssetCollection;

+ (void)phone:(NSString *)phoneNum;

+ (void)showAlert:(NSString *)message vc:(UIViewController *)vc;

+ (void)showAlert:(NSString *)message;

+ (void)showSheet:(NSArray<NSString *> *)messages withTitle:(NSString *)title vc:(UIViewController *)vc withSuccess:(void(^)(NSString *message))success withCutomStyle:(NSArray <UIColor *>*(^)())styleBack;

+(BOOL)isHaveEmptyString:(NSString *) string;

+ (BOOL)isChinese:(NSString *)str;

+(BOOL)checkCarID:(NSString *)carID;

+ (BOOL)isPhone:(NSString *)str;

@end




